﻿using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace PocketDOHS
{
    public partial class IPC : Form
    {        
        private TextBox txtFocus;

        public IPC()
        {
            InitializeComponent();
        }

        private void btnVoltar_Click(object sender, EventArgs e)
        {
            FormsMethods.prevForm();
        }

        private void Limpar_txt_Form()
        {
            txtDente11.Text = "";
            txtDente17.Text = "";
            txtDente26.Text = "";
            txtDente31.Text = "";
            txtDente36.Text = "";
            txtDente47.Text = "";
        }


        #region Changed

        private void WriteTextBox(object sender, EventArgs e)
        {
            FormsMethods.WriteTextBox((Button)sender, txtFocus, this);
        }

        private void TxtIPC(object sender, EventArgs e)
        {
            txtFocus = (TextBox)sender;
        }

        #endregion

        private void IPC_Activated(object sender, EventArgs e)
        {
            if (FormsMethods.Inicializa[FormsMethods.VetIndex])
            {
                Limpar_txt_Form();
                FormsMethods.Inicializa[FormsMethods.VetIndex] = false;
                txtDente17.Focus();
            }
            if (FormsMethods.Altera.ToArray()[FormsMethods.VetIndex])
            {
                FormsMethods.preencheForms();
                FormsMethods.Altera[FormsMethods.VetIndex] = false;
            }
        }

        private void btnGravar_Click(object sender, EventArgs e)
        {
            if ((txtDente11.Text != "") && (txtDente17.Text != "") && (txtDente26.Text != "") &&
                (txtDente31.Text != "") && (txtDente36.Text != "") && (txtDente47.Text != ""))
            {
                Dados.Guia.AvaliacaoClinica.IPC.d11 = txtDente11.Text;
                Dados.Guia.AvaliacaoClinica.IPC.d17_16 = txtDente17.Text;
                Dados.Guia.AvaliacaoClinica.IPC.d26_27 = txtDente26.Text;
                Dados.Guia.AvaliacaoClinica.IPC.d31 = txtDente31.Text;
                Dados.Guia.AvaliacaoClinica.IPC.d36_37 = txtDente36.Text;
                Dados.Guia.AvaliacaoClinica.IPC.d47_46 = txtDente47.Text;
                FormsMethods.nextForm();
            }
            else
                MessageBox.Show("Preencha Todos os Campos...", "ATENÇÃO!!");
        }


    }
}